import {
  Form,
  Input,
  Button,
  Radio,
  Select,
  Cascader,
  DatePicker,
  InputNumber,
  TreeSelect,
  Switch,
  Modal,
} from 'antd';
import React, { useState } from 'react';
import styles from './index.less';
import { Link } from 'umi';

export default props => {
  return (
    <div>
      <Modal
        title="科目保存"
        onCancel={props.onCancel}
        visible={props.visible}
        footer={null}
      >
        <Form
          labelCol={{ span: 4 }}
          wrapperCol={{ span: 14 }}
          layout="horizontal"
          initialValues={{ size: 'small' }}
          onValuesChange={props.onValuesChange}
          onFinish={props.onFinish}
          size={'small'}
        >
          <Form.Item name="parentCode" label="父级科目">
            <TreeSelect treeData={props.parentTree} treeDefaultExpandAll />
          </Form.Item>
          <Form.Item
            label="科目名称"
            name={'subjectName'}
            rules={[{ required: true, message: '请输入科目名称！' }]}
          >
            <Input />
          </Form.Item>
          <Form.Item
            label="科目Code"
            name={'subjectCode'}
            rules={[{ required: true, message: '请输入科目Code！' }]}
          >
            <Input />
          </Form.Item>
          <Form.Item
            label="辅助代码"
            name={'subjectHelpCode'}
            rules={[{ required: true, message: '请输入辅助代码！' }]}
          >
            <Input />
          </Form.Item>
          <Form.Item
            name="subjectDirection"
            label="借贷属性"
            rules={[{ required: true, message: '请选择借贷属性！' }]}
          >
            <Radio.Group>
              <Radio value={0}>借</Radio>
              <Radio value={1}>贷</Radio>
            </Radio.Group>
          </Form.Item>
          <Form.Item
            name="status"
            label="状态"
            rules={[{ required: true, message: '请选择状态！' }]}
          >
            <Radio.Group>
              <Radio value={1}>有效</Radio>
              <Radio value={0}>无效</Radio>
            </Radio.Group>
          </Form.Item>

          <Form.Item>
            <Button size={'middle'} type="primary" htmlType="submit">
              保存
            </Button>
          </Form.Item>
        </Form>
      </Modal>
    </div>
  );
};
